#ifndef _commpro_h_
#define _commpro_h_
/*
 *Following APIs should not be open
*/
#ifdef __cplusplus
extern "C"
{
#endif
#include <common.h>
#include <commapi.h>


int 
	COMMPULL_BROADCAST(char *CommLib, const char *Address, int *Cmd, char *SendBuf,int SendBufLen,char* RecvBuf, int *RecvBuflen, int TimeOutMS);

int 
	COMMPULL_COMSEARCH(char *CommLib, const char *Com, int *Cmd, char* SendBuf,int SendBufLen,char *RecvBuf, int *RecvBufLength, int TimeOutMS);

//use special communication library to connect with device, and initialization the protocol
UDK_HANDLE 
	COMMPULL_INIT(const char *CommLib, char *Address, unsigned short Port, int Speed, ZKECOMM_ReadCallBack ReadFun, void* Param, char *CommKey);

//close the connection and free resources
void 
	COMMPULL_CLOSE(UDK_HANDLE Handle);


//send a general command to device
int 
	COMMPULL_SENDCMD(UDK_HANDLE Handle, unsigned short *Cmd, 
	char *Buf, int *BufLen, int SendLen, int TimeOutMS);
int 
	COMMPULL_SENDCMD2(UDK_HANDLE Handle, unsigned short *Cmd, 
	char *Buf, int *BufLen, int SendLen, int TimeOutMS, int Wait, int *noRep);


//send a data buffer to device
int 
	COMMPULL_SENDDATA(UDK_HANDLE Handle, char *Buf, int BufLen,int BreakPos, int TimeOutMS);

//Last Error
int 
	COMMPULL_LASTERROR(void);

//send a special data buffer to device
int 
	COMMPULL_SENDCMDDATA(UDK_HANDLE Handle, unsigned short *Cmd, char *Buf, int *BufLen, 
	char *CmdBuf, int SendLen, int TimeOutMS);

int 
	COMMPULL_READCMDDATA(UDK_HANDLE Handle, unsigned short *Cmd, char *Buf, 
	int *BufLen, int SendLen, int TimeOutMS);
/*
//read data from device to buffer
int 
	ZEMBPRO_READDATA(UDK_HANDLE Handle, unsigned short *Cmd, char *Buf, 
	int BufLen, int SendLen, int BlockSize, int TimeOutMS);

int 
	ZEMBPRO_READDB(UDK_HANDLE Handle, SDK_U8 DBFlag, int BlockSize, char *Buffer, int *BufferSize);

SDK_BOOL
	ZEMBPRO_READMEMORY(UDK_HANDLE Handle, WORD DataMemory, DWORD StartAddress, int Size, int BlockSize, int TryCount, char *Buffer);
*/

#ifdef __cplusplus
}
#endif

#endif
